package com.kedacom.demo.redis.springdataredis.pubsub;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.redis.connection.Message;
import org.springframework.data.redis.connection.MessageListener;

import com.kedacom.demo.utils.StringSerializer;

/**
 * Consumer
 * @author luocanfeng
 * @date 2015年9月7日
 */
public class Consumer implements MessageListener {

	private Logger logger = LoggerFactory.getLogger(getClass());

	@Override
	public void onMessage(Message message, byte[] pattern) {
		logger.debug("Receive message, message='{}', channel='{}', pattern='{}'",
				StringSerializer.fromByteArray(message.getBody()),
				StringSerializer.fromByteArray(message.getChannel()), StringSerializer.fromByteArray(pattern));
	}

}
